package com.umeox.watch.moto.pedometer.base;

import android.content.Context;

import com.dbflow5.annotation.Database;
import com.dbflow5.config.DBFlowDatabase;
import com.dbflow5.config.DatabaseConfig;
import com.dbflow5.config.FlowConfig;
import com.dbflow5.config.FlowManager;
import com.dbflow5.database.AndroidSQLiteOpenHelper;


@Database(version = BaseDatabase.VERSION)
public abstract class BaseDatabase extends DBFlowDatabase {
    public static final String NAME = "Pedometer";
    public static final int VERSION = 1;

    public static void setup(Context context) {
        FlowManager.init(new FlowConfig.Builder(context)
                .database(DatabaseConfig.builder(BaseDatabase.class, AndroidSQLiteOpenHelper.createHelperCreator(context))
                        .databaseName(NAME)
                        .build())
                .build());
    }

    public static DBFlowDatabase getDatabase() {
        return FlowManager.getDatabase(NAME);
    }
}
